package TreeSet;

import demo1.Student1;

import java.util.ArrayList;
import java.util.Iterator;

public class GenericDemo2 {
    public static void main(String[] args) {
        // 创建集合
        ArrayList<Student1> list = new ArrayList<Student1>();
        //向集合中添加自定义对象Student
        list.add(new Student1("班长", 19));
        list.add(new Student1("班花", 18));
        list.add(new Student1("班草", 23));
        list.add(new Student1("副班长", 19));
        //遍历集合
        for (Iterator<Student1> it = list.iterator(); it.hasNext(); ) {
            Student1 s = it.next();
            System.out.println("我叫" + s.getName() + ",我今年" + s.getAge());
        }
        QueueDemo<String> qd = new QueueDemo<String>();
        qd.addElement("abc");
        qd.addElement("hello");
        qd.addElement("java");
        while (qd.isNull()) {
            //表示有数据
            String s = qd.getElement();
            System.out.println(s);
        }
    }
}
